<template>
    <div style="height:100%;width:100%;position:relative;" ref="maindev">
        <div class="pagetop" :style="{ height:'103px' }">
            <table style="width: 100%; font-size: 12px;" border="0">
                <col style="width: 4%;" />
                <col style="width: 8%;" />
                <col style="width: 1%;" />
                <col style="width: 8%;" />
                <col style="width: 4%;" />
                <col style="width: 11%;" />
                <col style="width: 4%;" />
                <col style="width: 11%;" />
                <col style="width: 4%;" />
                <col style="width: 11%;" />
                <col style="width: 43%;" />
                <tr>
                    <td align="right">报告日期</td>
                    <td>
                        <el-date-picker v-model="sel1stobj.startdt" :able="false" type="date" placeholder="选择日期" value-format="yyyy-MM-dd" style="width: 100%;min-width: 100px;" :clearable="false"></el-date-picker>
                    </td>
                    <td>至</td>
                    <td>
                        <el-date-picker v-model="sel1stobj.enddt" type="date" :able="false" placeholder="选择日期" :default-time="['23:59:59']" value-format="yyyy-MM-dd" style="width: 100%;min-width: 100px;" :clearable="false"> </el-date-picker>
                    </td>
                    <td align="right">报告单元</td>
                    <td>
                        <el-select v-model="sel1stobj.rptunitid" @dblclick.native="PopMultipleChk(sel1stobj.rptunitid, 'sel1stobj.rptunitid', rptunitOption, '请选择报告单元')" filterable clearable style="width:100%">
                            <el-option v-for="(item, index) in rptunitOption" :key="index" :value="item.data" :label="item.display"></el-option>
                        </el-select>
                    </td>
                    <td align="right">标本号</td>
                    <td>
                        <el-input size="small" style="width:100%;" placeholder="输入如1,2,5-8等格式" v-model="sel1stobj.sampleno"></el-input>
                    </td>
                    <td colspan="3">
                    </td>
                </tr>
                <tr>
                    <td align="right">多项目条件</td>
                    <td colspan="3">
                        <el-select v-model="sel1stobj.resultcomb" clearable style="width:calc( 100% - 46px);">
                            <el-option v-for="(item,index) in resultcombOption" :value="item.data" :label="item.display" :key="index"></el-option>
                        </el-select>
                        <el-button align="right" @click="OpenResultComb(1)">自定义</el-button>
                    </td>
                    <td align="right">临床诊断</td>
                    <td>
                        <el-input size="small" style="width:100%;" v-model="sel1stobj.pat_diag"></el-input>
                    </td>
                    <td align="right">标本类型</td>
                    <td>
                        <el-select v-model="sel1stobj.specimen_code" @dblclick.native="PopMultipleChk(sel1stobj.specimen_code, 'sel1stobj.specimen_code', specimenOption, '请选择标本类型')" filterable clearable style="width:100%">
                            <el-option v-for="(item, index) in specimenOption" :key="index" :value="item.data" :label="item.display"></el-option>
                        </el-select>
                    </td>
                </tr>
                <tr>
                    <td colspan="5" align="left" style="align:left;text-align:left;width:100%;font-size:16px;font-weight:600">
                        <el-tag style="margin:1.5px 5px;height:26px;font-size:16px;line-height:26px">{{patmsg}}</el-tag>
                    </td>
                    <td colspan="6" align="right" style="text-align:right;width:100%">
                        <el-button icon="el-icon-search" v-has="'PINQUERY'" type="primary" @click="Btn1stQuery">初次查询(F8)</el-button>
                        <el-button v-if="bStop2Flag=='1'" icon="el-icon-search" v-has="'PINQUERY'" type="primary" @click="Btn2ndSel">二次查询(F9)</el-button>
                        <el-button v-else icon="el-icon-minus" type="danger" @click="Stop2Q">停止</el-button>
                        <el-button icon="el-icon-delete" @click="BtnClear">清 除(C)</el-button>
                        <el-button icon="el-icon-upload2" v-has="'PEXPORT'" @click="BtnExport()">导 出</el-button>
                        <el-button icon="el-icon-close" @click="BtnExc" type="warning">退出(E)</el-button>
                    </td>
                </tr>
            </table>
        </div>
        <div class="pagecenter">
            <div class="middle_center">
                <el-tabs v-model="activeTabName" @tab-click="HandleClick" style="height:100%;" type="border-card" ref="tabs">
                    <el-tab-pane label="初次查询" name="rpt1stQuery">
                        <vxe-table :data.sync="rpt1stData" :loading="rptIstLoading" :select-config="{reserve: true}" :sort-config="{trigger: 'cell'}" border height="auto" highlight-current-row highlight-hover-column highlight-hover-row how-header-overflow ref="rpt1stTable" resizable show-overflow size="mini" stripe show-header-overflow :optimization="{animat: false}" header-align="center" :key="rpt1stkey">
                            <!-- <vxe-table-column type="index" align="center" title="序号" width="40"></vxe-table-column> -->
                            <vxe-table-column field="pat_no" sortable title="病人号" width="120" show-overflow></vxe-table-column>
                            <vxe-table-column field="pat_name" align="center" sortable title="姓名" width="60" show-overflow></vxe-table-column>
                            <vxe-table-column field="pat_sexname" align="center" sortable title="性别" width="35" show-overflow></vxe-table-column>
                            <vxe-table-column field="pat_agestr" sortable title="年龄" width="40" show-overflow></vxe-table-column>
                            <!-- <vxe-table-column :key="item.field" :field="item.field" :title="item.title" v-for="item in tableColumn" align="center" :width="item.width" sortable :sort-width="item.field=='sampleno'?20:0"></vxe-table-column> -->
                            <!-- <template v-slot:fix>
                                <div style="font-size:12px;padding-top:3px;background-color:#fff;"><span style="color:red;margin-left:10px;float:right;">合计: {{rpt_aomount}}</span>
                                    <div style="clear:both"></div>
                                </div>
                            </template> -->
                        </vxe-table>
                    </el-tab-pane>
                    <el-tab-pane label="二次查询" name="rpt2ndQuery">
                        <vxe-table :data.sync="rpt2ndData" :select-config="{reserve: true}" :sort-config="{trigger: 'cell'}" border height="auto" highlight-current-row highlight-hover-column highlight-hover-row how-header-overflow ref="rpt2ndTable" resizable show-overflow size="mini" stripe show-header-overflow :optimization="{animat: false}" header-align="center" :key="rpt2ndkey">
                            <vxe-table-column :key="item.field" :field="item.field" :title="item.title" v-for="item in tableColumn" align="center" :width="item.width" sortable :sort-width="item.field=='sampleno'?20:0"></vxe-table-column>
                            <template v-slot:fix>
                                <!-- <div style="font-size:12px;padding-top:3px;background-color:#fff;"><span style="color:red;margin-left:10px;float:right;">合计: {{rpt_aomount}}</span>
                                    <div style="clear:both"></div>
                                </div> -->
                                <div style="font-size:12px;float:top;padding-top:3px;background-color:#fff;">
                                    <el-progress :text-inside="true" :stroke-width="15" :percentage=percentage status="success"></el-progress>
                                </div>
                                <div style="clear:both"></div>
                            </template>
                        </vxe-table>

                    </el-tab-pane>
                </el-tabs>
            </div>
        </div>
        <!--多选弹窗--->
        <el-dialog width="830px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :title="multichktitle" :visible.sync="dialogMultipleVisible" :destroy-on-close="true">
            <rm-SqlMultiple :leftOption="option1" :rightOption="option2" :name="fieldname" @change="Closedialog"></rm-SqlMultiple>
        </el-dialog>
        <el-dialog width="1000px" height="90px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="结果组合查询条件" :visible.sync="bResultCombDlg" :destroy-on-close="true">
            <div style="height:90px" v-show="bSaveResultComb">
                <table style="width: 100%; font-size: 12px;">
                    <col style="width: 10%;" />
                    <col style="width: 23%;" />
                    <col style="width: 10%;" />
                    <col style="width: 23%;" />
                    <col style="width: 10%;" />
                    <col style="width: 23%;" />
                    <tr>
                        <td>
                            条件代码
                        </td>
                        <td>
                            <el-input v-model="save1stobj.queryresultno" style="width:100%" ref="input1" @keyup.enter.native="NextFocus(1)"></el-input>
                        </td>
                        <td>
                            条件名称
                        </td>
                        <td>
                            <el-input v-model="save1stobj.queryresultname" style="width:100%" ref="input2" @keyup.enter.native="NextFocus(2)"></el-input>
                        </td>
                        <td>
                            用户
                        </td>
                        <td>
                            <rm-ddl-common datatype="userinfo" dataname="用户" v-model="save1stobj.createuser" width="100%" :disabled="utype!='G'"></rm-ddl-common>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            备注
                        </td>
                        <td colspan="5">
                            <el-input type="textarea" v-model="save1stobj.description" rows="2" ref="input3" @keyup.enter.native="NextFocus(3)"></el-input>
                        </td>
                    </tr>
                </table>
            </div>
            <div style="text-align:right;height:30px">
                <el-button icon="el-icon-circle-check" style="align:right" @click="BtnSure(1)" v-show="!bSaveResultComb" type="primary">确定</el-button>
                <el-button icon="el-icon-circle-close" style="align:right" @click="BtnCancel(1)" v-show="!bSaveResultComb">取消</el-button>
                <el-button icon="el-icon-plus" style="align:left" @click="AddItem(1)">新增明细</el-button>
                <el-button icon="el-icon-delete" style="align:left" @click="DelItem(1)">删除明细</el-button>
                <el-button icon="el-icon-folder-add" style="align:right" @click="BtnToSave(1)" v-show="!bSaveResultComb&&addPower">另存为</el-button>
                <el-button icon="el-icon-document" style="align:right" @click="BtnSave(1)" v-show="bSaveResultComb" type="primary">保存</el-button>
                <el-button icon="el-icon-back" style="align:right" @click="BtnGoBack(1)" v-show="bSaveResultComb">返回</el-button>
            </div>
            <div style="height:270px">
                <vxe-table show-overflow ref="com1stTable" :data.sync="com1stData" height="auto" :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true, showIcon: false }" @cell-dblclick="CellDblclick" border size="mini" show-header-overflow highlight-current-row highlight-hover-row resizable stripe header-align="center">
                    <vxe-table-column field="seq" title="序号" align="center" width="55" :edit-render="{name: 'input'}" sortable></vxe-table-column>
                    <vxe-table-column field="rpt_itemname" title="报告项目(双击弹窗)" width="145" :edit-render="{name:'input', autoselect: true, attrs: {readonly: true}}" sortable></vxe-table-column>
                    <vxe-table-column field="resistrules" title="耐药机制" width="150" :edit-render="{type: 'default'}">
                        <template v-slot="{ row }">
                            <el-select v-model="row.resistrules"  @dblclick.native="popMultipleChk_R(row.resistrules, 'resistrules', rescodeOption, '耐药机制选择','1')" style="width: 100%;" filterable clearable>
                                <el-option v-for="(item, index) in rescodeOption" :key="index" :value="item.data" :label="item.display"> </el-option>
                            </el-select>
                        </template>
                    </vxe-table-column>
                    <vxe-table-column field="lowlimit" title="数值结果<" width="90" :edit-render="{name: 'input',autoselect: true}" sortable></vxe-table-column>
                    <vxe-table-column field="uplimit" title="数值结果>" width="90" :edit-render="{name: 'input',autoselect: true,}" sortable></vxe-table-column>
                    <vxe-table-column field="txtoperator" title="文字结果条件" width="95" sortable>
                        <template v-slot="{ row }">
                            <el-select v-model="row.txtoperator" placeholder="请选择">
                                <el-option v-for="item in txtoperatorOptions" :key="item.value" :label="item.label" :value="item.value">
                                </el-option>
                            </el-select>
                        </template>
                    </vxe-table-column>
                    <vxe-table-column field="txtresults" title="文字结果（多个,隔开）" width="140" :edit-render="{name: 'input',autoselect: true}" sortable></vxe-table-column>
                    <vxe-table-column field="txtlike" sortable title="文字模糊匹配" width="85" align="center">
                        <template v-slot="{ row }">
                            <el-checkbox v-model="row.txtlike" true-label="1" false-label="0"></el-checkbox>
                        </template>
                    </vxe-table-column>
                    <vxe-table-column field="mustinclude" title="必选条件" width="60" align="center">
                        <template v-slot="{ row }">
                            <el-checkbox v-model="row.mustinclude" true-label="1" false-label="0"></el-checkbox>
                        </template>
                    </vxe-table-column>
                </vxe-table>
            </div>
            <!-- <div style="font-size:17px;padding:3px;background-color:#fff;text-align:center;font-weight:bold">
            </div> -->
        </el-dialog>
        <el-dialog width="1000px" height="90px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="结果组合查询条件" :visible.sync="bResultCombDlg2" :destroy-on-close="true">
            <div style="height:90px" v-show="bSaveResultComb2">
                <table style="width: 100%; font-size: 12px;">
                    <col style="width: 10%;" />
                    <col style="width: 23%;" />
                    <col style="width: 10%;" />
                    <col style="width: 23%;" />
                    <col style="width: 10%;" />
                    <col style="width: 23%;" />
                    <tr>
                        <td>
                            条件代码
                        </td>
                        <td>
                            <el-input v-model="save2ndobj.queryresultno" style="width:100%" ref="input1" @keyup.enter.native="NextFocus(1)"></el-input>
                        </td>
                        <td>
                            条件名称
                        </td>
                        <td>
                            <el-input v-model="save2ndobj.queryresultname" style="width:100%" ref="input2" @keyup.enter.native="NextFocus(2)"></el-input>
                        </td>
                        <td>
                            用户
                        </td>
                        <td>
                            <rm-ddl-common datatype="userinfo" dataname="用户" v-model="save2ndobj.createuser" width="100%" :disabled="utype!='G'"></rm-ddl-common>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            备注
                        </td>
                        <td colspan="5">
                            <el-input type="textarea" v-model="save2ndobj.description" rows="2" ref="input3" @keyup.enter.native="NextFocus(3)"></el-input>
                        </td>
                    </tr>
                </table>
            </div>
            <div style="text-align:right;height:30px">
                <el-button icon="el-icon-circle-check" style="align:right" @click="BtnSure(2)" v-show="!bSaveResultComb2" type="primary">确定</el-button>
                <el-button icon="el-icon-circle-close" style="align:right" @click="BtnCancel(2)" v-show="!bSaveResultComb2">取消</el-button>
                <el-button icon="el-icon-plus" style="align:left" @click="AddItem(2)">新增明细</el-button>
                <el-button icon="el-icon-delete" style="align:left" @click="DelItem(2)">删除明细</el-button>
                <el-button icon="el-icon-folder-add" style="align:right" @click="BtnToSave(2)" v-show="!bSaveResultComb2&&addPower">另存为</el-button>
                <el-button icon="el-icon-document" style="align:right" @click="BtnSave(2)" v-show="bSaveResultComb2" type="primary">保存</el-button>
                <el-button icon="el-icon-back" style="align:right" @click="BtnGoBack(2)" v-show="bSaveResultComb2">返回</el-button>
            </div>
            <div style="height:270px">
                <vxe-table show-overflow ref="com2ndTable" :data.sync="com2ndData" height="auto" :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true, showIcon: false }" @cell-dblclick="CellDblclick" border size="mini" show-header-overflow highlight-current-row highlight-hover-row resizable stripe header-align="center">
                    <vxe-table-column field="seq" title="序号" align="center" width="55" :edit-render="{name: 'input'}" sortable></vxe-table-column>
                    <vxe-table-column field="rpt_itemname" title="报告项目(双击弹窗)" width="145" :edit-render="{name:'input', autoselect: true, attrs: {readonly: true}}" sortable></vxe-table-column>
                    <vxe-table-column field="resistrules" title="耐药机制" width="150" :edit-render="{type: 'default'}">
                        <template v-slot="{ row }">
                            <el-select v-model="row.resistrules"  @dblclick.native="popMultipleChk_R(row.resistrules, 'resistrules', rescodeOption, '耐药机制选择','2')" style="width: 100%;" filterable clearable>
                                <el-option v-for="(item, index) in rescodeOption" :key="index" :value="item.data" :label="item.display"> </el-option>
                            </el-select>
                        </template>
                    </vxe-table-column>
                    <vxe-table-column field="lowlimit" title="数值结果<" width="90" :edit-render="{name: 'input',autoselect: true}" sortable></vxe-table-column>
                    <vxe-table-column field="uplimit" title="数值结果>" width="90" :edit-render="{name: 'input',autoselect: true,}" sortable></vxe-table-column>
                    <vxe-table-column field="txtoperator" title="文字结果条件" width="95" sortable>
                        <template v-slot="{ row }">
                            <el-select v-model="row.txtoperator" placeholder="请选择">
                                <el-option v-for="item in txtoperatorOptions" :key="item.value" :label="item.label" :value="item.value">
                                </el-option>
                            </el-select>
                        </template>
                    </vxe-table-column>
                    <vxe-table-column field="txtresults" title="文字结果（多个,隔开）" width="140" :edit-render="{name: 'input',autoselect: true}" sortable></vxe-table-column>
                    <vxe-table-column field="txtlike" sortable title="文字模糊匹配" width="85" align="center">
                        <template v-slot="{ row }">
                            <el-checkbox v-model="row.txtlike" true-label="1" false-label="0"></el-checkbox>
                        </template>
                    </vxe-table-column>
                    <!-- <vxe-table-column field="mustinclude" title="必选条件" width="60" align="center">
                        <template v-slot="{ row }">
                            <el-checkbox v-model="row.mustinclude" true-label="1" false-label="0"></el-checkbox>
                        </template>
                    </vxe-table-column> -->
                </vxe-table>
            </div>
            <!-- <div style="font-size:17px;padding:3px;background-color:#fff;text-align:center;font-weight:bold">
            </div> -->
        </el-dialog>
        <el-dialog width="800px" top="10px" :append-to-body="true" :close-on-click-modal="false" title="二次查询条件" :visible.sync="b2ndDlg" :destroy-on-close="true">
            <div style="height:195px">
                <table style="width: 100%; font-size: 12px;" border="0">
                    <col style="width: 4%;" />
                    <col style="width: 8%;" />
                    <col style="width: 1%;" />
                    <col style="width: 8%;" />
                    <col style="width: 4%;" />
                    <col style="width: 15%;" />
                    <col style="width: 4%;" />
                    <col style="width: 15%;" />
                    <col style="width: 41%;" />
                    <tr>
                        <td align="right">报告日期</td>
                        <td>
                            <el-date-picker v-model="sel2ndobj.startdt" :able="false" type="date" placeholder="选择日期" value-format="yyyy-MM-dd" style="width: 100%;min-width: 100px;" :clearable="false"></el-date-picker>
                        </td>
                        <td>至</td>
                        <td>
                            <el-date-picker v-model="sel2ndobj.enddt" type="date" :able="false" placeholder="选择日期" :default-time="['23:59:59']" value-format="yyyy-MM-dd" style="width: 100%;min-width: 100px;" :clearable="false"> </el-date-picker>
                        </td>
                        <td align="right">报告单元</td>
                        <td>
                            <el-select v-model="sel2ndobj.rptunitid" @dblclick.native="PopMultipleChk(sel2ndobj.rptunitid, 'sel2ndobj.rptunitid', rptunitOption, '请选择报告单元')" filterable clearable style="width:100%">
                                <el-option v-for="(item, index) in rptunitOption" :key="index" :value="item.data" :label="item.display"></el-option>
                            </el-select>
                        </td>
                        <td align="right">病人类型</td>
                        <td>
                            <el-select v-model="sel2ndobj.pat_typecode" @dblclick.native="PopMultipleChk(sel2ndobj.pat_typecode,'sel2ndobj.pat_typecode',pattypeOption,'病人类型选择')" filterable clearable style="width:100%">
                                <el-option v-for="(item,index) in pattypeOption" :value="item.data" :label="item.display" :key="index"></el-option>
                            </el-select>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">标本号</td>
                        <td colspan="3">
                            <el-input size="small" style="width:100%;" placeholder="输入如1,2,5-8等格式" v-model="sel2ndobj.sampleno"></el-input>
                        </td>
                        <td align="right">报告项目</td>
                        <td>
                            <el-input v-model="sel2ndobj.rpt_itemcode" @dblclick.native="bRptItemDlg=true" readonly clearable placeholder="双击选择报告项目"></el-input>
                            <!-- <rm-ddl-rptitem prgno="LIS417" :germmode="false" v-model="sel2ndobj.rpt_itemcode" width="100%" :rptunitid="sel2ndobj.rptunitid" :appendtobody="true">
                            </rm-ddl-rptitem> -->
                        </td>
                        <td align="right">病人性别</td>
                        <td>
                            <el-select v-model="sel2ndobj.pat_sex" placeholder="请选择" style="width:100%">
                                <el-option key="0" label="全部" value="0"></el-option>
                                <el-option key="1" label="男" value="1"></el-option>
                                <el-option key="2" label="女" value="2"></el-option>
                            </el-select>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">多项目条件</td>
                        <td colspan="3">
                            <el-select v-model="sel2ndobj.resultcomb" clearable style="width:calc( 100% - 46px);">
                                <el-option v-for="(item,index) in resultcombOption" :value="item.data" :label="item.display" :key="index"></el-option>
                            </el-select>
                            <el-button align="right" @click="OpenResultComb(2)">自定义</el-button>
                        </td>
                        <td align="right">临床诊断</td>
                        <td>
                            <el-input size="small" style="width:100%;" v-model="sel2ndobj.pat_diag"></el-input>
                        </td>
                        <td align="right">标本类型</td>
                        <td>
                            <el-select v-model="sel2ndobj.specimen_code" @dblclick.native="PopMultipleChk(sel2ndobj.specimen_code, 'sel2ndobj.specimen_code', specimenOption, '请选择标本类型')" filterable clearable style="width:100%">
                                <el-option v-for="(item, index) in specimenOption" :key="index" :value="item.data" :label="item.display"></el-option>
                            </el-select>
                        </td>
                    </tr>
                    <tr>
                        <td align="right"></td>
                        <td>
                            <el-checkbox true-label="1" false-label="0" v-model="showcols.show_pat_sex" @change="showColsChange()">显示病人性别</el-checkbox>
                        </td>
                        <td></td>
                        <td>
                            <el-checkbox true-label="1" false-label="0" v-model="showcols.show_pat_typecode" @change="showColsChange()">显示病人类型</el-checkbox>
                        </td>
                        <td align="right"></td>
                        <td>
                            <el-checkbox true-label="1" false-label="0" v-model="showcols.show_pat_agestr" @change="showColsChange()">显示年龄</el-checkbox>
                        </td>
                        <td align="right"></td>
                        <td>
                            <el-checkbox true-label="1" false-label="0" v-model="showcols.show_req_dept" @change="showColsChange()">显示申请科室</el-checkbox>
                        </td>
                    </tr>
                    <tr>
                        <td align="right"></td>
                        <td>
                            <el-checkbox true-label="1" false-label="0" v-model="showcols.show_req_ward" @change="showColsChange()">显示病区</el-checkbox>
                        </td>
                        <td></td>
                        <td>
                            <el-checkbox true-label="1" false-label="0" v-model="showcols.show_req_bedno" @change="showColsChange()">显示床号</el-checkbox>
                        </td>
                        <td align="right"></td>
                        <td>
                            <el-checkbox true-label="1" false-label="0" v-model="showcols.show_req_doc" @change="showColsChange()">显示申请医生</el-checkbox>
                        </td>
                        <td align="right"></td>
                        <td>
                            <el-checkbox true-label="1" false-label="0" v-model="showcols.show_pat_idcardno" @change="showColsChange()">显示身份证号</el-checkbox>
                        </td>
                    </tr>
                    <tr>
                        <td align="right"></td>
                        <td>
                            <el-checkbox true-label="1" false-label="0" v-model="showcols.show_pat_diag" @change="showColsChange()">显示临床诊断</el-checkbox>
                        </td>
                        <td></td>
                        <td></td>
                        <td align="right"></td>
                        <td></td>
                        <td align="right"></td>
                        <td></td>
                    </tr>
                    <tr>
                        <!-- <td colspan="4" style="align:left;text-align:left;width:100%;font-size:16px;color:red;font-weight:600"> {{patmsg}}</td> -->
                        <td colspan="11" style="align:right;text-align:right;width:100%">
                            <el-button icon="el-icon-search" v-has="'PINQUERY'" type="primary" @click="Btn2ndQueryCol">二次查询(F10)</el-button>
                            <!-- <el-button icon="el-icon-delete" @click="BtnClear">清除</el-button> -->
                        </td>
                    </tr>
                </table>
            </div>
        </el-dialog>
        <el-dialog width="1000px" top="10px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="报告项目" :visible.sync="bRptItemDlg" :destroy-on-close="true">
            <rm-pop-selrptitem @cancel="bRptItemDlg=false;" @selitem="AddRptItem"></rm-pop-selrptitem>
        </el-dialog>
        <el-dialog width="1000px" top="10px" :append-to-body="true" :close-on-click-modal="false" title="选择报告项目" :visible.sync="rpt_itemDlg" :destroy-on-close="true">
            <rm-pop-rptitem prgno="LIS156" @cancel="rpt_itemDlg=false;" :isAllRpt="1" @selitem="Rpt_itemChange" :rptunitid="txtrptunit"></rm-pop-rptitem>
        </el-dialog>
        <el-dialog width="1000px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="耐药机制选择" :visible.sync="dialogMultipleVisible_R" :destroy-on-close="true">
            <rm-SqlMultiple :leftOption="option1" :rightOption="option2" :name="fieldname" @change="closedialog_R"></rm-SqlMultiple>
        </el-dialog>
    </div>
</template>


<script>
import XEUtils from "xe-utils"; //引入工具类
export default {
    name: "LIS417",
    data() {
        return {
            //*初始化
            utype: "",
            txtrptunit: "",
            patmsg: "请先点击【查询】按钮查询出所有病人。",
            rptunitOption: [],
            pattypeOption: [],
            specimenOption: [],
            resultcombOption: [],
            txtoperatorOptions: [
                {
                    value: "In",
                    label: "等于",
                },
                {
                    value: "NotIn",
                    label: "不等于",
                },
            ],
            activeTabName: "rpt1stQuery", //默认tab页
            rpt1stkey: 0,
            rpt2ndkey: 0,
            //*多选组件
            option1: [],
            option2: [],
            fieldname: "",
            multichktitle: "",
            dialogMultipleVisible: false, //多选弹框
            // bMultipleItem: false,
            //*多项目
            bResultCombDlg: false, //多项目弹窗
            bResultCombDlg2: false, //多项目弹窗
            bSaveResultComb: false, //多项目保存DIV显示
            bSaveResultComb2: false, //多项目保存DIV显示
            rpt_itemDlg: false, //报告项目弹窗
            addPower: false, // 组合查询条件授权
            com1stData: [], //VxetableList
            com2ndData: [], //VxetableList
            temp1stComData: [], //temp VxetableList
            temp2ndComData: [], //temp VxetableList
            //*初次查询
            rptIstLoading: false, //初次查询Loading
            rpt1stData: [], //初次报告数据
            //初次查询条件
            sel1stobj: {
                //查询框初始值
                rptunitid: "", //报告单元ID
                startdt: XEUtils.toDateString(XEUtils.getWhatDay(new Date(), -30), "yyyy-MM-dd"),
                enddt: XEUtils.toDateString(new Date(), "yyyy-MM-dd"),
                // rpt_itemcode: "", //报告项目
                sampleno: "", //标本号
                pat_diag: "", //临床诊断
                specimen_code: "", //标本类型
                resultcomb: "", //多项目条件
            },
            //多项目
            save1stobj: {
                queryresultno: "",
                queryresultname: "",
                createuser: "",
                description: "",
            },
            save2ndobj: {
                queryresultno: "",
                queryresultname: "",
                createuser: "",
                description: "",
            },
            //*二次查询
            b2ndDlg: false,
            bRptItemDlg: false,
            rpt2ndData: [],
            tableColumn: [],
            percentage: 0, //进度条
            bStop2Flag: "1",
            //二次查询条件
            sel2ndobj: {
                //查询框初始值
                rptunitid: "", //报告单元ID
                startdt: XEUtils.toDateString(XEUtils.getWhatDay(new Date(), -30), "yyyy-MM-dd"),
                enddt: XEUtils.toDateString(new Date(), "yyyy-MM-dd"),
                rpt_itemcode: "", //报告项目
                pat_typecode: "", //病人类别
                pat_sex: "", //病人性别
                sampleno: "", //标本号
                pat_diag: "", //临床诊断
                specimen_code: "", //标本类型
                resultcomb: "", //多项目条件
            },
            rptitemname: "",
            // selrow: {},
            // tableheight: "auto",
            rpt_aomount: 0, //合计
            //显示列，默认全显示
            showcols: {
                show_pat_sex: "1",
                show_pat_typecode: "1",
                show_pat_agestr: "1",
                show_req_dept: "1",
                show_req_ward: "1",
                show_req_bedno: "1",
                show_req_doc: "1",
                show_pat_idcardno: "1",
                show_pat_diag: "1",
            },
            //耐药机制
            rescodeOption: [],
            dialogMultipleVisible_R: false,
            seartype:"1",
            exportTableColLen: 0,
        };
    },
    created() {
        this.LoginUser();
        this.GetSavePower();
        this.BtnClear();
    },
    mounted() {
        this.initOption();
    },
    methods: {
        //? ****************初始化获取数据******************//
        //获取用户
        LoginUser() {
            this.utype = this.$tool.getSession(this.$tool.loginutype);
            if (this.utype == "G") {
                this.save1stobj.createuser = "_Global_";
                this.save2ndobj.createuser = "_Global_";
            } else {
                this.save1stobj.createuser = this.$tool.getSession(this.$tool.loginusername);
                this.save2ndobj.createuser = this.$tool.getSession(this.$tool.loginusername);
            }
        },
        //获取Option
        /*      rptunitOption           报告单元
                specimenOption      样本类型
                resultcombOption  多项目条件
        */
        async initOption() {
            try {
                const res = await this.$tool.request({
                    url: "LIS/LIS4/LIS417",
                    method: "post",
                    data: {
                        action: "getOption",
                    },
                });
                this.rptunitOption = res.rptunitOption;
                this.pattypeOption = res.pattypeOption;
                this.specimenOption = res.specimenOption;
                this.resultcombOption = res.resultcombOption;
                this.rescodeOption=res.rescodeOption;
                //读取缓存
                let jsonList = localStorage.getItem("rm_LIS417_ShowCols");
                if (jsonList != "" && jsonList != null) {
                    let tempOption = JSON.parse(jsonList);
                    this.showcols = tempOption;
                }
            } catch (e) {
                this.$message.warning(e);
            }
        },
        //TAB点击事件
        HandleClick(tab) {
            if (tab.label == "初次查询") {
                this.rpt1stkey++;
            } else if (tab.label == "二次查询") {
                this.rpt2ndkey++;
            }
        },
        //? ******************初次查询************************/
        //报告项目
        Rpt_itemChange(code, name) {
            this.selrow.rpt_itemcode = code;
            this.selrow.rpt_itemname = name;
            this.rpt_itemDlg = false;
        },
        //初次查询 用于显示第一次查询的病人基本信息及结果，及所有病人pat_no
        Btn1stQuery() {
            this.activeTabName = "rpt1stQuery";
            this.rpt1stData = [];
            this.rpt2ndData = [];
            this.bStop2Flag = "1";
            this.rptIstLoading = true;
            this.patmsg = "初次查询中，请稍候。";
            this.tableColumn = [];
            this.percentage = 0;
            this.rpt2ndData = [];
            this.$tool
                .request({
                    url: "LIS/LIS4/LIS417",
                    method: "post",
                    timeout: 600000,
                    data: {
                        action: "query",
                        ...this.sel1stobj,
                        comblist: this.temp1stComData,
                    },
                })
                .then((res) => {
                    if (res.dt && res.dt.length > 0) {
                        this.rpt1stData = res.dt;
                        this.patmsg = "本次查询出病人数:" + res.dt.length + "。";
                    } else this.patmsg = "本次查询无数据。";
                    this.sel2ndobj.startdt = this.sel1stobj.startdt;
                    this.sel2ndobj.enddt = this.sel1stobj.enddt;
                    this.sel2ndobj.rptunitid = this.sel1stobj.rptunitid;
                    this.rptIstLoading = false;
                })
                .catch((e) => {
                    this.patmsg = "请先点击【查询】按钮查询出所有病人。";
                    this.$message.error(e);
                    this.rptIstLoading = false;
                });
        },
        //? ************************下面是二次查询*******************//
        Btn2ndSel() {
            if (this.rpt1stData.length > 0) {
                this.b2ndDlg = true;
            } else {
                this.$alert("请先查询出有效数据。", "提示", {
                    confirmButtonText: "确定",
                });
            }
        },
        Stop2Q() {
            this.bStop2Flag = "1";
        },
        //二次查询 用于显示第一次查询的病人基本信息及结果，及所有病人pat_no
        Btn2ndQueryCol() {
            this.rpt2ndData = [];
            this.tableColumn = [];
            this.activeTabName = "rpt2ndQuery";
            this.percentage = 0;
            this.b2ndDlg = false;
            this.bStop2Flag = "0";
            this.$tool
                .request({
                    url: "LIS/LIS4/LIS417",
                    method: "post",
                    timeout: 600000,
                    data: {
                        action: "query2ndcol",
                        ...this.sel2ndobj,
                        ...this.showcols,
                        comblist: this.temp2ndComData,
                    },
                })
                .then((res) => {
                    if (res.colflag && res.colflag == "1") {
                        this.tableColumn = res.Cols;
                        this.Btn2ndQueryData(this, this.rpt1stData, res.Cols, 0);
                        // if (res.colmsg != "") {
                        //     this.$message({
                        //         type: "info",
                        //         message: "当前项目超过200，仅显示前200个项目。",
                        //     });
                        // }
                    } else if (res.colflag == "0") {
                        if (res.colmsg != "") {
                            this.$message({
                                type: "info",
                                message: res.colmsg,
                            });
                        }
                    }
                    // this.rptIstLoading = false;
                })
                .catch((e) => {
                    console.log(e);
                    this.$message.error(e);
                    // this.rptIstLoading = false;
                });
        },
        Btn2ndQueryData(that, data, Cols, index) {
            if (index < data.length) {
                let item = data[index];
                this.$tool
                    .request({
                        url: "LIS/LIS4/LIS417",
                        method: "post",
                        timeout: 600000,
                        data: {
                            action: "query2nddata",
                            ...this.sel2ndobj,
                            comblist: this.temp2ndComData,
                            pat_no: item.pat_no,
                            pat_name: item.pat_name,
                            sel_showna: "0",
                            qindex: index,
                            ...this.showcols,
                            // Cols: Cols,
                        },
                    })
                    .then((res) => {
                        if (res && res.length > 0)
                            res.forEach((e) => {
                                this.rpt2ndData.push(e);
                            });
                        this.patmsg = "正在进行二次查询：" + (index + 1) + "/" + data.length + "。";
                        this.percentage = parseInt((index / data.length) * 100);
                        if (this.bStop2Flag == "0") this.Btn2ndQueryData(that, data, Cols, index + 1);
                    })
                    .catch((e) => {
                        console.log(e);
                    });
            } else {
                this.percentage = 100;
                if (data.length == index) {
                    this.patmsg = "本次二次查询结束：" + index + "/" + data.length + "。";
                }
                this.bStop2Flag = "1";
                console.log("结束");
            }
        },
        showColsChange(){
            let jsonList = JSON.stringify(this.showcols);
            localStorage.setItem("rm_LIS417_ShowCols", jsonList);
        },
        //报告项目添加多选
        AddRptItem(rptiteminfos) {
            this.sel2ndobj.rpt_itemcode = "";
            this.rptitemname = "";
            for (var i = 0; i < rptiteminfos.length; i++) {
                if (this.sel2ndobj.rpt_itemcode == "") {
                    this.sel2ndobj.rpt_itemcode = rptiteminfos[i].rpt_itemcode;
                    this.rptitemname = rptiteminfos[i].rpt_itemname;
                } else {
                    this.sel2ndobj.rpt_itemcode += "," + rptiteminfos[i].rpt_itemcode;
                    this.rptitemname += "," + rptiteminfos[i].rpt_itemname;
                }
            }
            this.bRptItemDlg = false;
        },
        //!**********以下为多项目条件*********/
        //多项目条件
        OpenResultComb(flag) {
            //无需初始化表格内的数值，方便重复查询
            //自定义与选择查询重叠||二选一，待测试
            //先满足表格直接查询,再考虑满足保存，可以优先画好全部界面。
            if (flag == 1) {
                this.com1stData = XEUtils.clone(this.temp1stComData, true);
                if(this.com1stData.length>0){
                    this.$refs.com1stTable.setCurrentRow(this.com1stData[0]);
                }
                this.bResultCombDlg = true;
            } else {
                this.com2ndData = XEUtils.clone(this.temp2ndComData, true);
                if(this.com2ndData.length>0){
                    this.$refs.com2ndTable.setCurrentRow(this.com2ndData[0]);
                }
                this.bResultCombDlg2 = true;
            }
        },
        //报告项目弹窗
        CellDblclick({ row, column }) {
            if (column.property == "rpt_itemname") {
                this.selrow = row;
                this.rpt_itemDlg = true;
            }
        },
        //确定
        BtnSure(flag) {
            if (flag == 1) {
                this.sel1stobj.resultcomb = "";
                this.temp1stComData = XEUtils.clone(this.$refs.com1stTable.getTableData().fullData, true);
                this.bResultCombDlg = false;
            } else {
                this.sel2ndobj.resultcomb = "";
                this.temp2ndComData = XEUtils.clone(this.$refs.com2ndTable.getTableData().fullData, true);
                this.bResultCombDlg2 = false;
            }
        },
        //取消
        BtnCancel(flag) {
            if (flag == 1) {
                this.com1stData = XEUtils.clone(this.temp1stComData, true);
                this.bResultCombDlg = false;
            } else {
                this.com2ndData = XEUtils.clone(this.temp2ndComData, true);
                this.bResultCombDlg2 = false;
            }
        },
        //增加明细
        AddItem(flag) {
            if (flag == 1) {
                this.$refs.com1stTable
                    .insert({
                        queryresultno: this.save1stobj.queryresultno,
                        seq: this.$refs.com1stTable.tableFullData.length > 0 ? (Math.floor(this.$refs.com1stTable.tableFullData[this.$refs.com1stTable.tableFullData.length - 1].seq / 10) + 1) * 10 : 10,
                        txtoperator: "In",
                        txtlike: 0,
                        mustinclude: 1,
                        resistrules:"",
                    })
                    .then(({ row }) => {
                        this.$nextTick(() => {
                            this.$refs.com1stTable.setCurrentRow(row);
                        });
                    });
            } else {
                this.$refs.com2ndTable
                    .insert({
                        queryresultno: this.save2ndobj.queryresultno,
                        seq: this.$refs.com2ndTable.tableFullData.length > 0 ? (Math.floor(this.$refs.com2ndTable.tableFullData[this.$refs.com2ndTable.tableFullData.length - 1].seq / 10) + 1) * 10 : 10,
                        txtoperator: "In",
                        txtlike: 0,
                        mustinclude: 0,
                        resistrules:"",
                    })
                    .then(({ row }) => {
                        this.$nextTick(() => {
                            this.$refs.com2ndTable.setCurrentRow(row);
                        });
                    });
            }
        },
        //删除明细
        DelItem(flag) {
            if (flag == 1) {
                try {
                    var delrow = this.$refs.com1stTable.getCurrentRow();
                    if (delrow) {
                        var alld = this.$refs.com1stTable.tableData;
                        var rowindex = alld.indexOf(delrow);
                        this.$refs.com1stTable.remove(delrow);
                        let havedata = this.$refs.com1stTable.tableData;
                        if (havedata.length > 0) {
                            if (rowindex >= havedata.length) rowindex = havedata.length - 1;
                            let selectrow = havedata[rowindex];
                            this.$refs.com1stTable.setCurrentRow(selectrow);
                        } else {
                            this.$message({
                                message: "请先选中要删除的明细！",
                                type: "warning",
                            });
                            this.$refs.com1stTable.setCurrentRow(null);
                        }
                    }
                } catch (e) {
                    console.log("error", e);
                }
            } else {
                try {
                    var delrow = this.$refs.com2ndTable.getCurrentRow();
                    if (delrow) {
                        var alld = this.$refs.com2ndTable.tableData;
                        var rowindex = alld.indexOf(delrow);
                        this.$refs.com2ndTable.remove(delrow);
                        let havedata = this.$refs.com2ndTable.tableData;
                        if (havedata.length > 0) {
                            if (rowindex >= havedata.length) rowindex = havedata.length - 1;
                            let selectrow = havedata[rowindex];
                            this.$refs.com2ndTable.setCurrentRow(selectrow);
                        } else {
                            this.$message({
                                message: "请先选中要删除的明细！",
                                type: "warning",
                            });
                            this.$refs.com2ndTable.setCurrentRow(null);
                        }
                    }
                } catch (e) {
                    console.log("error", e);
                }
            }
        },
        //前往维护
        BtnToSave(flag) {
            if (flag == 1) {
                this.bSaveResultComb = true;
                setTimeout(() => {
                    this.$refs.input1.focus();
                }, 30);
            } else {
                this.bSaveResultComb2 = true;
                setTimeout(() => {
                    this.$refs.input1.focus();
                }, 30);
            }
        },
        //返回
        BtnGoBack(flag) {
            if (flag == 1) {
                this.bSaveResultComb = false;
            } else {
                this.bSaveResultComb2 = false;
            }
        },
        //多项目条件回车
        NextFocus(index) {
            if (index > 2) return false;
            var that = this;
            var focusIndex = index + 1;
            setTimeout(function () {
                that.$refs["input" + focusIndex].focus();
            }, 1);
        },
        //授权
        async GetSavePower() {
            try {
                const res = await this.$tool.request({
                    url: "LIS/LIS4/LIS413",
                    method: "post",
                    timeout: 600000,
                    data: {
                        action: "get_savepower",
                    },
                });
                this.addPower = res;
            } catch (e) {
                this.$message.warning(e);
            }
        },
        //保存多项目条件
        async BtnSave(flag) {
            try {
                let data = [];
                if (flag == 1) {
                    data = this.$refs.com1stTable.getTableData().fullData;
                    var addparam = this.save1stobj;
                } else {
                    data = this.$refs.com2ndTable.getTableData().fullData;
                    var addparam = this.save2ndobj;
                }
                for (let i = 0, len = data.length; i < len; i++) {
                    let tempseq = (i + 1) * 10;
                    if (tempseq !== data[i].seq) {
                        data[i].seq = tempseq;
                    }
                    if (flag == 1) {
                        data[i].queryresultno = this.save1stobj.queryresultno; //修正主键
                    } else {
                        data[i].queryresultno = this.save2ndobj.queryresultno; //修正主键
                    }
                }
                const res = await this.$tool.request({
                    url: "LIS/LIS1/LIS156",
                    method: "post",
                    timeout: 600000,
                    data: {
                        action: "addsearchadition",
                        utype: 1,
                        addparam: addparam,
                        upt: data,
                    },
                });
                if (res.errcode == "1") {
                    this.$message.success("保存成功！");
                    this.Freshcomb(); //保存成功刷新主键
                    if (flag == 1) {
                        this.bSaveResultComb = false;
                        this.bResultCombDlg = false;
                    } else {
                        this.bSaveResultComb2 = false;
                        this.bResultCombDlg2 = false;
                    }
                } else if (res.errcode == "0") {
                    this.$message.error(res.errmsg);
                }
            } catch (e) {
                this.$message.warning(e);
            }
        },
        //刷新多项目条件
        async Freshcomb() {
            try {
                const res = await this.$tool.request({
                    url: "LIS/LIS4/LIS417",
                    method: "post",
                    data: {
                        action: "getOption",
                    },
                });
                this.resultcombOption = res.resultcombOption;
            } catch (e) {
                this.$message.warning(e);
            }
        },
        // PopMultipleItem() {
        //     this.bMultipleItem = true;
        // },
        //多选弹框
        PopMultipleChk(e, fieldname, option, title) {
            let temp = XEUtils.clone(option, true);
            this.option1 = [];
            this.option2 = [];
            if (e != "") {
                let k = e.split(",");
                k.forEach((item) => {
                    let ndata = temp.find((m) => m.data == item);
                    if (ndata != undefined && ndata != null) {
                        this.option2.push(ndata);
                    }
                });
                temp.forEach((item) => {
                    if (k.indexOf(item.data + "") < 0) {
                        this.option1.push(item);
                    }
                });
            } else {
                this.option1 = temp;
            }
            this.fieldname = fieldname;
            this.multichktitle = title;
            this.dialogMultipleVisible = true;
        },
        //关闭多选框
        Closedialog(value, name, showname) {
            if (value != "close") {
                var narr = name.split(".");
                this[narr[0]][narr[1]] = value;
            }
            this.dialogMultipleVisible = false;
        },
        //清除
        BtnClear() {
            this.rptIstLoading = false;
            this.rpt1stData = [];
            this.rpt2ndData = [];
            this.tableColumn = [];
            this.temp1stComData = [];
            this.temp2ndComData = [];
            this.com1stData = [];
            this.com2ndData = [];
            this.percentage = [];
            this.percentage = 0;
            this.patmsg = "请先点击【初次查询】按钮查询出所有病人。";
            this.sel1stobj = {
                //查询框初始值
                rptunitid: "", //报告单元ID
                startdt: XEUtils.toDateString(XEUtils.getWhatDay(new Date(), -30), "yyyy-MM-dd"),
                enddt: XEUtils.toDateString(new Date(), "yyyy-MM-dd"),
                rpt_itemcode: "", //报告项目
                sampleno: "", //标本号
                pat_diag: "", //临床诊断
                specimen_code: "", //标本类型
                resultcomb: "", //多项目条件
            };
            this.sel2ndobj = {
                //查询框初始值
                rptunitid: "", //报告单元ID
                startdt: XEUtils.toDateString(XEUtils.getWhatDay(new Date(), -30), "yyyy-MM-dd"),
                enddt: XEUtils.toDateString(new Date(), "yyyy-MM-dd"),
                rpt_itemcode: "", //报告项目
                pat_typecode: "", //病人类别
                pat_sex: "", //病人性别
                sampleno: "", //标本号
                pat_diag: "", //临床诊断
                specimen_code: "", //标本类型
                resultcomb: "", //多项目条件
            };
        },
        BtnExport() {
            var flag = 2;
            if (this.activeTabName == "rpt1stQuery") {
                flag = 1;
            }
            let data = [];
            data = this.getExportData(flag);
            let filtertxt = this.getExportFilter(flag);
            // 保存导出
            if (flag == 1) this.$pub.exportTableExcelWithData(data, this.exportTableColLen, "LIS417项目结果二次统计报表-初次查询.xlsx", filtertxt);
            else if (flag == 2) this.$pub.exportTableExcelWithData(data, this.exportTableColLen, "LIS417项目结果二次统计报表-二次查询.xlsx", filtertxt);
        },
        // 获取当前导出文件的所有查询条件
        getExportFilter(flag) {
            let filtertxt = "";
            if(flag == 1) {
                filtertxt += "报告日期:" + XEUtils.toDateString(this.sel1stobj.startdt, "yyyy-MM-dd") + "至" + XEUtils.toDateString(this.sel1stobj.enddt, "yyyy-MM-dd") + "; ";
                if(this.sel1stobj.rptunitid) filtertxt += "报告单元:" + this.getOptionName(this.rptunitOption.filter((item) =>  ("," + this.sel1stobj.rptunitid + ",").indexOf("," + item.data + ",") > -1)) + "; ";
                if(this.sel1stobj.sampleno) filtertxt += "标本号:" + this.sel1stobj.sampleno + "; ";
                if(this.sel1stobj.resultcomb) filtertxt += "多项目条件:" + this.getOptionName(this.resultcombOption.filter((item) =>  this.sel1stobj.resultcomb == item.data)) + "; ";
                if(this.sel1stobj.pat_diag) filtertxt += "临床诊断:" + this.sel1stobj.pat_diag + "; ";
                if(this.sel1stobj.specimen_code) filtertxt += "标本类型:" + this.getOptionName(this.specimenOption.filter((item) =>  ("," + this.sel1stobj.specimen_code + ",").indexOf("," + item.data + ",") > -1)) + "; ";
            } else {
                filtertxt += "报告日期:" + XEUtils.toDateString(this.sel2ndobj.startdt, "yyyy-MM-dd") + "至" + XEUtils.toDateString(this.sel2ndobj.enddt, "yyyy-MM-dd") + "; ";
                if(this.sel2ndobj.rptunitid) filtertxt += "报告单元:" + this.getOptionName(this.rptunitOption.filter((item) =>  ("," + this.sel2ndobj.rptunitid + ",").indexOf("," + item.data + ",") > -1)) + "; ";
                if(this.sel2ndobj.pat_typecode) filtertxt += "病人类型:" + this.getOptionName(this.pattypeOption.filter((item) =>  ("," + this.sel2ndobj.pat_typecode + ",").indexOf("," + item.data + ",") > -1)) + "; ";
                if(this.sel2ndobj.sampleno) filtertxt += "标本号:" + this.sel2ndobj.sampleno + "; ";
                if(this.sel2ndobj.rpt_itemcode) filtertxt += "报告项目:" + this.rptitemname + "; ";
                if(this.sel2ndobj.pat_sex) filtertxt += "病人性别:" + (this.sel2ndobj.pat_sex == "1" ? "男" : this.sel2ndobj.pat_sex == "2" ? "女" : "全部") + "; ";
                if(this.sel2ndobj.resultcomb) filtertxt += "多项目条件:" + this.getOptionName(this.resultcombOption.filter((item) =>  this.sel2ndobj.resultcomb == item.data)) + "; ";
                if(this.sel2ndobj.pat_diag) filtertxt += "临床诊断:" + this.sel2ndobj.pat_diag + "; ";
                if(this.sel2ndobj.specimen_code) filtertxt += "标本类型:" + this.getOptionName(this.specimenOption.filter((item) =>  ("," + this.sel2ndobj.specimen_code + ",").indexOf("," + item.data + ",") > -1)) + "; ";
                if(this.showcols.show_pat_sex) filtertxt += "显示病人性别; ";
                if(this.showcols.show_pat_typecode) filtertxt += "显示病人类型; ";
                if(this.showcols.show_pat_agestr) filtertxt += "显示年龄; ";
                if(this.showcols.show_req_dept) filtertxt += "显示申请科室; ";
                if(this.showcols.show_req_ward) filtertxt += "显示病区; ";
                if(this.showcols.show_req_bedno) filtertxt += "显示床号; ";
                if(this.showcols.show_req_doc) filtertxt += "显示申请医生; ";
                if(this.showcols.show_pat_idcardno) filtertxt += "显示身份证号; ";
                if(this.showcols.show_pat_diag) filtertxt += "显示临床诊断; ";
            }
            return filtertxt;
        },
        getOptionName(option) {
            if (option && option.length > 0) {
                let optionname = "";
                option.forEach((item) => {
                    if(item.hasOwnProperty("display")) {
                        optionname += item.display + ",";
                    } else {
                        optionname += item.label + ",";
                    }
                });
                return optionname.substring(0, optionname.length - 1);
            } else {
                return "";
            }
        },
        getExportData(flag) {
            let datas = [];
            let tableColumn = [];
            if (flag == 1) {
                datas = this.$refs.rpt1stTable.afterFullData;
                var allcolumns = this.$refs.rpt1stTable.getColumns();
            } else {
                datas = this.$refs.rpt2ndTable.afterFullData;
                var allcolumns = this.$refs.rpt2ndTable.getColumns();
            }
            for (let i = 0; i < allcolumns.length; i++) {
                tableColumn.push({
                    field: allcolumns[i].property,
                    title: allcolumns[i].title,
                });
            }
            this.exportTableColLen = tableColumn.length;
            let columns = tableColumn.filter((item) => item.field);
            let headers = [columns.map((item) => item.title)];
            return headers.concat(
                datas.map((row) => {
                    return columns.map((column) => {
                        return row[column.field];
                    });
                })
            );
        },
        BtnExc() {
            let index = this.$parent.$refs.itemtags.tagsList.findIndex((m) => m.name == "LIS417");
            this.$parent.$refs.itemtags.tagsList.splice(index, 1);
            this.$router.go(-1);
        },
        popMultipleChk_R(e, fieldname, option, title,type) {
            this.seartype=type;
            console.log("e",e)
            let temp = XEUtils.clone(option, true)
            this.option1 = []
            this.option2 = []
            if (!e) {
                let k = e.split(",")
                k.forEach((item) => {
                    let ndata = temp.find((m) => m.data == item)
                    if (ndata != undefined && ndata != null) {
                        this.option2.push(ndata)
                    }
                })
                temp.forEach((item) => {
                    if (k.indexOf(item.data + "") < 0) {
                        this.option1.push(item)
                    }
                })
            } else {
                this.option1 = temp
            }
            this.fieldname = fieldname
            this.dialogMultipleVisible_R = true
        },
        closedialog_R(value, name) {
            var tablename="com1stTable";
            if(this.seartype=="1"){
                tablename="com1stTable";
            }else if (this.seartype=="2"){
                tablename="com2ndTable";
            }
            if (value != "close") {
                let row = this.$refs[tablename].getCurrentRow();
                if(row){
                    row.resistrules=value;
                }
            }
            this.dialogMultipleVisible_R = false
        },
    },
    //快捷键 暂时不提示使用吧
    beforeRouteEnter(to, from, next) {
        next((vm) => {
            let that = vm;
            let altArr = [];
            document.onkeydown = function (e) {
                let key = window.event.keyCode;
                //*组合按键
                if (altArr.length > 0) {
                    //65到90 a到z（A到Z）
                    // //*Alt + C 清除
                    if (key == 67) {
                        that.BtnClear();
                    }
                    //*Alt + E 退出
                    if (key == 69) {
                        that.BtnExc();
                    }
                } else {
                    if (key == 119) {
                        //F8
                        that.Btn1stQuery();
                    } else if (key == 120) {
                        //F9
                        that.Btn2ndSel(e);
                    } else if (key == 121) {
                        //F10
                        if (that.b2ndDlg) {
                            that.Btn2ndQueryCol();
                        }
                    } else if (key == 18) {
                        //按下了alt
                        altArr.push(key);
                    }
                }
            };
            document.onkeyup = function (e) {
                let key = window.event.keyCode;
                if (key == 18) {
                    altArr = [];
                }
            };
        });
    },
    
};
</script>

<style scoped>
::v-deep .el-checkbox__inner::after {
    border: 2px solid #000000 !important;
    box-sizing: content-box;
    content: "";
    border-left: 0 !important;
    border-top: 0 !important;
    height: 7px;
    left: 4px;
    position: absolute;
    top: 1px;
    transform: rotate(45deg) scaleY(0);
    width: 3px;
    transition: transform 0.15s ease-in 0.05s;
    transform-origin: center;
}
::v-deep .vxe-table--header .vxe-header--column {
    border-right: 1px solid #cccccc;
    border-bottom: 1px solid #ccc;
}
::v-deep .el-checkbox__input.is-disabled + span.el-checkbox__label {
    color: #000000;
    cursor: not-allowed;
}
::v-deep .el-checkbox__input.is-disabled .el-checkbox__inner,
.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner + .el-input.is-disabled .el-input__inner {
    background-color: #ffffff !important;
}
.pagetop {
    left: 0;
    right: 0;
    display: -webkit-box;
    -webkit-box-pack: center;
    -webkit-box-align: center;
    border: solid 1px #ccc;
    position: absolute;
    z-index: 99;
    overflow-x: auto;
    white-space: nowrap;
}
.pagecenter {
    position: absolute;
    top: 107px;
    bottom: 0px;
    overflow: auto;
    width: 100%;
    left: 0px;
}
.middle_center {
    position: absolute;
    height: 100%;
    right: 0px;
    left: 0px;
    overflow: auto;
}
.middle-right {
    position: absolute;
    top: 0;
    bottom: 0px;
    overflow: visible;
    width: 570px;
    right: 0px;
}
table tr td:nth-child(odd) {
    text-align: right;
    white-space: nowrap;
}
table tr td:nth-child(even) {
    text-align: left;
}
table tr td:nth-child(1) {
    width: 80px;
}
table {
    font-size: 12px;
    border-collapse: separate;
    border-spacing: 5px;
}
.middle-center {
    height: 250px;
}
::v-deep .el-input--suffix .el-input__inner {
    padding-right: 0;
}
::v-deep .el-textarea__inner {
    padding: 0px 5px;
}
</style>